package jjn.round2;

/**
 * @author Jjn
 * @since 2023/7/5 10:12
 */
public class LeetCode2600 {
    public int kItemsWithMaximumSum(int numOnes, int numZeros, int numNegOnes, int k) {
        if (numOnes >= k) {
            return k;
        }
        if (numOnes + numZeros >= k) {
            return numOnes;
        }
        int restCount = k - numOnes - numZeros;
        return numOnes - restCount;
    }
    
    public static void main(String[] args) {
        int kItemsWithMaximumSum = new LeetCode2600().kItemsWithMaximumSum(3, 3, 5, 11);
        System.out.println("kItemsWithMaximumSum = " + kItemsWithMaximumSum);
    }
}
